package com.justinwang4.androidservicedemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.justinwang4.androidservicedemo.activities.MyIntentServiceActivity;
import com.justinwang4.androidservicedemo.activities.MyServiceActivity;
import com.justinwang4.androidservicedemo.services.MyIntentService;

public class MainActivity extends AppCompatActivity {

    private Button btnTurnToServiceActivity;
    private Button btnTurnToIntentServiceActivity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btnTurnToServiceActivity = findViewById(R.id.btn_turn_to_service);
        btnTurnToServiceActivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, MyServiceActivity.class);
                startActivity(intent);
            }
        });

        btnTurnToIntentServiceActivity = findViewById(R.id.btn_turn_to_intent_service);
        btnTurnToIntentServiceActivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, MyIntentServiceActivity.class);
                startActivity(intent);
            }
        });
    }
}